package com.zr.domain.sp.tool.mq.listener;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.TimeUnit;

@Component
@RabbitListener(queues = "directQueue")//监听的队列名称 directQueue
public class DirectMessageListener {
    @RabbitHandler
    public void process(Map message, Channel channel) {

        try {
            TimeUnit.MILLISECONDS.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("DirectReceiver消费者收到消息  : " + message.toString());

    }

}
